import axios from "axios";
import { apiUrl } from "../domain";
import type { AxiosRequestConfig, AxiosResponse } from "axios";
const instance = axios.create({
    baseURL: apiUrl,
    timeout: 5000,
})


export default function <AnyName>(config: AxiosRequestConfig) {
    return new Promise<AnyName>((resolve, reject) => {
        instance.request(config)
            .then((response: AxiosResponse) => {
                resolve(response.data)
            }).catch(error => {
                reject(error)
            })
    })
}

